#include"../mqcommom/helper.hpp"
#include"../mqcommom/Log.hpp"
using namespace ns_helper;
using namespace std;

int main()
{
    FileHelper helper("../mqcommom/Log.hpp");
    std::cout<<"文件是否存在:"<<helper.IsExists()<<std::endl;
    cout<<"文件大小:"<<helper.Size()<<std::endl;

    // //测试打开文件
    FileHelper tem_helper("./a/b/c/tem.hpp");
    if(!tem_helper.IsExists())
    {
        //获取父目录
        std::string parentdirct=FileHelper::ParentDirctory("./a/b/c/tem.hpp");
        std::cout<<parentdirct<<endl;
        //创建父目录
        if(!FileHelper(parentdirct.c_str()).IsExists());
            cout<<"创建目录:"<<FileHelper::CreateDirctory(parentdirct)<<endl;;
        //创建文件
         std::cout<<FileHelper::CreateFile("./a/b/c/tem.hpp")<<endl;
         lg.LogMessage(Info,"创建目录成功!");
    }

    //读取文件
    char buffer[128];
    helper.Read(buffer,8,4);
    cout<<buffer<<endl;
    std::string outbuffer="11111111111";
     tem_helper.Write(outbuffer);
    tem_helper.Write(buffer,10,5);
    return 0;
}